function login() {
	var us = document.getElementById('us').value;
	var ps = document.getElementById('pw').value;
	var stat = document.getElementById('status');

	if (us == "" || ps == "") {
		stat.innerHTML = "Cannot have empty credentials";
		return false;
	}

	var param = "us=" + us + "&pw=" + ps;

	var url = "proceedLogin";
	var ajax1 = new ajaxCall(param,url,function(status, text, xml) {
		if (status == 200) {
			var msg = xml.getElementsByTagName("message")[0].childNodes[0].nodeValue;
			if (msg != "ok") {
				document.getElementById('status').innerHTML = msg;
			} 
			else {
				var day = xml.getElementsByTagName("day")[0].childNodes[0].nodeValue;
				var user = xml.getElementsByTagName("us")[0].childNodes[0].nodeValue;
				var role = xml.getElementsByTagName("role")[0].childNodes[0].nodeValue;
				var id = xml.getElementsByTagName("userId")[0].childNodes[0].nodeValue;
				
				url = "main.jsp?day=" + escape(day) + "&us="+ escape(user) + "&role=" + role + "&id=" + id;
				
				window.location.href = window.location.href.replace(
						"login.jsp", url);
			}
		}
	});
};
		
function clear() {
	document.getElementById('us').value = "";
	document.getElementById('ps').value = "";
	document.getElementById('status').innerHTML = "";
	return false;
};